/**
 * @file	sdk_config.h
 * @author	chipsea
 * @brief	
 * @version	0.1
 * @date	2021-01-21
 * @copyright Copyright (c) 2020, CHIPSEA Co., Ltd.
 * @note
 */
 
 
#ifndef __SDK_CONFIG_H__
#define __SDK_CONFIG_H__


// <<< Use Configuration Wizard in Context Menu >>>\n

// <h> General parameter config

// <o> PROGRAM_TYPE  - Config bootloader type
// <0=> mini bootloader type,bootloader without ble ability
// <1=> ota bootloader type ,bootloader with ble ability
// <2=> ota application type ,application with ble ability
#ifndef PROGRAM_TYPE
#define PROGRAM_TYPE 2
#endif

// <o> OTA_BANK_MODE  - Config OTA Upgrade mode
// <0=> Double bank upgrade 
// <1=> single bank upgrade 
#ifndef OTA_BANK_MODE
#define OTA_BANK_MODE 1
#endif

// <s.20> DEVICE_NAME  - Config device name
#ifndef DEVICE_NAME
#define DEVICE_NAME	"TSS-Writer"
#endif

// <o> CFG_SLEEP_MODE  - Config power mode about sleep 
// <i> PWR_MODE_NO_SLEEP: full speed to run,  PWR_MODE_SLEEP: run-sleep-run-sleep,  PWR_MODE_PWROFF_NO_SLEEP: don't sleep but can poweroff
// <1=> PWR_MODE_NO_SLEEP 
// <2=> PWR_MODE_SLEEP 
// <4=> PWR_MODE_PWROFF_NO_SLEEP 
#ifndef CFG_SLEEP_MODE
#define CFG_SLEEP_MODE 1
#endif

// <o> CFG_DCDC_ENABLE  - Config Buck DCDC enable
// <i> CFG_DCDC_ENABLE: DCDC_DISABLE or DCDC_ENABLE
// <0=> DCDC_DISABLE 
// <1=> DCDC_ENABLE 
#ifndef CFG_DCDC_ENABLE
#define CFG_DCDC_ENABLE 0
#endif

// <o> DEFAULT_TX_POWER_VALUE  - Config default RF transmit power value
// <i> It have file options: 5dBm, 0dBm, -2dBm, -5dBm, -20dBm
// <0x05=> 5dBm
// <0x00=> 0dBm
// <0xFE=> -2dBm
// <0xFB=> -5dBm
// <0xEC=> -20dBm
#ifndef DEFAULT_TX_POWER_VALUE
#define DEFAULT_TX_POWER_VALUE 0x00 
#endif


#if (CFG_DCDC_ENABLE == 0)
	// 0x1d: RF_PHY_TX_POWER_5DBM, 5dBm
	// 0x0d: RF_PHY_TX_POWER_0DBM, 0dBm
	// 0x0a: RF_PHY_TX_POWER_N2DBM, -2dBm
	// 0x06: RF_PHY_TX_POWER_N5DBM, -5dBm
	// 0x01: RF_PHY_TX_POWER_N20DBM, -20dBm
	#if (DEFAULT_TX_POWER_VALUE == 0x05)
		#define DEFAULT_TX_POWER 0x1d
	#elif (DEFAULT_TX_POWER_VALUE == 0x00)
		#define DEFAULT_TX_POWER 0x0d
	#elif (DEFAULT_TX_POWER_VALUE == 0xFE)
		#define DEFAULT_TX_POWER 0x0a
	#elif (DEFAULT_TX_POWER_VALUE == 0xFB)
		#define DEFAULT_TX_POWER 0x06
	#elif (DEFAULT_TX_POWER_VALUE == 0xEC)
		#define DEFAULT_TX_POWER 0x01
	#else
		#define DEFAULT_TX_POWER 0x0A
		#warning Don't support current power value, use 0dBm configuration
	#endif
#else
	// 0x3f: RF_PHY_TX_POWER_5DBM, 5dBm
	// 0x1f: RF_PHY_TX_POWER_0DBM, 0dBm
	// 0x0f: RF_PHY_TX_POWER_N2DBM, -2dBm
	// 0x0a: RF_PHY_TX_POWER_N5DBM, -5dBm
	// 0x01: RF_PHY_TX_POWER_N20DBM, -20dBm
	#if (DEFAULT_TX_POWER_VALUE == 0x05)
		#define DEFAULT_TX_POWER 0x3f
	#elif (DEFAULT_TX_POWER_VALUE == 0x00)
		#define DEFAULT_TX_POWER 0x1f
	#elif (DEFAULT_TX_POWER_VALUE == 0xFE)
		#define DEFAULT_TX_POWER 0x0f
	#elif (DEFAULT_TX_POWER_VALUE == 0xFB)
		#define DEFAULT_TX_POWER 0x0a
	#elif (DEFAULT_TX_POWER_VALUE == 0xEC)
		#define DEFAULT_TX_POWER 0x01
	#else
		#define DEFAULT_TX_POWER 0x0A
		#warning Don't support current power value, use 0dBm configuration
	#endif
#endif

// <o> DEFAULT_SYS_CLK_SRC  - Config default system clock source
// <i> SYS_CLK_XTAL_16M: 16MHz,  SYS_CLK_DLL_48M: 48MHz,  SYS_CLK_DLL_64M: 64MHz
// <2=> SYS_CLK_XTAL_16M
// <3=> SYS_CLK_DLL_48M 
// <4=> SYS_CLK_DLL_64M 
#ifndef DEFAULT_SYS_CLK_SRC
#define DEFAULT_SYS_CLK_SRC 4
#endif

// <o> DEFAULT_32K_CLK_SRC  - Config default 32KHz clock source
// <i> CLK_32K_XTAL: use external 32.768K crystal. CLK_32K_RCOSC: use internal RC oscillator
// <0=> CLK_32K_XTAL 
// <1=> CLK_32K_RCOSC 
#ifndef DEFAULT_32K_CLK_SRC
#define DEFAULT_32K_CLK_SRC 0
#endif

// <o> DEBUG_INFO  - Config debug information output level
// <0=> No debug information output
// <1=> User info output, use LOG() to output information 
// <2=> System info output, use AT_LOG() and LOG_DEBUG() to output information 
// <3=> All info output, use LOG(), AT_LOG() and LOG_DEBUG() to output information 
#ifndef DEBUG_INFO
#define DEBUG_INFO 0
#endif

// </h> 

// <h> Bluetooth LE parameter config

// <o> DEFAULT_DESIRED_ADV_INTERVAL - Config default desired advertising interval, unit time is 0.625ms
// <32-16384>
#ifndef DEFAULT_DESIRED_ADV_INTERVAL
#define DEFAULT_DESIRED_ADV_INTERVAL 160
#endif

// <o> DEFAULT_DESIRED_MIN_CONN_INTERVAL - Config default desired minimum connection interval interval if automatic parameter update request is enabled, unit time is 1.25ms
// <6-65535>
#ifndef DEFAULT_DESIRED_MIN_CONN_INTERVAL
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 12
#endif

// <o> DEFAULT_DESIRED_MAX_CONN_INTERVAL - Config default desired maximum connection interval interval if automatic parameter update request is enabled, unit time is 1.25ms
// <6-65535>
#ifndef DEFAULT_DESIRED_MAX_CONN_INTERVAL
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 16
#endif

// <o> DEFAULT_DESIRED_SLAVE_LATENCY - Config default desired slave latency if automatic parameter update request is enabled
// <0-65535>
#ifndef DEFAULT_DESIRED_SLAVE_LATENCY
#define DEFAULT_DESIRED_SLAVE_LATENCY 0
#endif

// <o> DEFAULT_DESIRED_CONN_TIMEOUT - Config default desired supervision timeout value if automatic parameter update request is enabled, unit time is 10ms
// <10-3200>
#ifndef DEFAULT_DESIRED_CONN_TIMEOUT
#define DEFAULT_DESIRED_CONN_TIMEOUT 500
#endif

// <e> DEFAULT_ENABLE_UPDATE_REQUEST - Enable automatic parameter update request when a connection is formed
#ifndef DEFAULT_ENABLE_UPDATE_REQUEST
#define DEFAULT_ENABLE_UPDATE_REQUEST 1
#endif

// <o> DEFAULT_CONN_PAUSE_PERIPHERAL - Minimum time upon connection establishment before the peripheral starts a connection update procedure. In seconds(default 5 seconds)
// <0-65535>
#ifndef DEFAULT_CONN_PAUSE_PERIPHERAL
#define DEFAULT_CONN_PAUSE_PERIPHERAL 5
#endif

// </e> 

// <q> DEFAULT_GAPBOND_MGR_ENABLE - Enable GAP bond manager
#ifndef DEFAULT_GAPBOND_MGR_ENABLE
#define DEFAULT_GAPBOND_MGR_ENABLE 0
#endif

// </h> 

// <h> OSAL config

// <o> OSAL_CBTIMER_NUM_TASKS  - It defines the number of OSAL callback timers that can be used
// <0=> Don't use CBTimer 
// <1=> CBTimer number is 1
// <2=> CBTimer number is 2 
#ifndef OSAL_CBTIMER_NUM_TASKS
#define OSAL_CBTIMER_NUM_TASKS 1
#if (OSAL_CBTIMER_NUM_TASKS == 0)
#undef OSAL_CBTIMER_NUM_TASKS
#endif
#endif

// </h> 

#endif


